﻿<UserControl x:Class="BallOnTiltablePlate.TimoSchmetzer.Simulation.BasicSimulation"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:d3="clr-namespace:Microsoft.Research.DynamicDataDisplay;assembly=DynamicDataDisplay"
             xmlns:controls="clr-namespace:JRapp.WPF;assembly=JRapp.WPF"
             xmlns:controlsB3="clr-namespace:JRapp.WPF"
             xmlns:JRappWPF="clr-namespace:JRapp.WPF;assembly=JRapp.WPF"
             xmlns:Visualizer="clr-namespace:BallOnTiltablePlate.JanRapp.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="557" d:DesignWidth="613">
    <UserControl.Resources>
        <RoutedCommand x:Key="ToogleRunningCmd">
            <RoutedCommand.InputGestures>
                <KeyGesture>Control+P</KeyGesture>
            </RoutedCommand.InputGestures>
        </RoutedCommand>
        <RoutedCommand x:Key="ToogleRecordCmd">
            <RoutedCommand.InputGestures>
                <KeyGesture>Control+R</KeyGesture>
            </RoutedCommand.InputGestures>
        </RoutedCommand>
        <RoutedCommand x:Key="AddPermissionCmd">
            <RoutedCommand.InputGestures>
                <KeyGesture>Control+I</KeyGesture>
            </RoutedCommand.InputGestures>
        </RoutedCommand>
        <RoutedCommand x:Key="RemovePermissionCmd">
            <RoutedCommand.InputGestures>
                <KeyGesture>Control+O</KeyGesture>
            </RoutedCommand.InputGestures>
        </RoutedCommand>
        <Style TargetType="{x:Type TextBox}">
            <Setter Property="JRappWPF:SettingsSaver.PropertiesToSave" 
    				Value="Text"/>
        </Style>
        <Style TargetType="controls:DoubleBox" BasedOn="{StaticResource {x:Type controls:DoubleBox}}">
            <Setter Property="SmallChange" Value="0.001"/>
            <Setter Property="RegularChange" Value="0.01"/>
            <Setter Property="LargeChange" Value="0.1"/>
            <Setter Property="Value" Value="0.00"/>
        </Style>
        <Style TargetType="controls:VectorBox" BasedOn="{StaticResource {x:Type controls:VectorBox}}">
            <Setter Property="SmallChange" Value="0.001"/>
            <Setter Property="RegularChange" Value="0.01"/>
            <Setter Property="LargeChange" Value="0.1"/>
            <Setter Property="Value" Value="0,0"/>
        </Style>
        <Style TargetType="controls:Vector3DBox" BasedOn="{StaticResource {x:Type controls:Vector3DBox}}">
            <Setter Property="SmallChange" Value="0.001"/>
            <Setter Property="RegularChange" Value="0.01"/>
            <Setter Property="LargeChange" Value="0.1"/>
            <Setter Property="Value" Value="0,0,0"/>
        </Style>
        <Style TargetType="controls:RectBox" BasedOn="{StaticResource {x:Type controls:RectBox}}">
            <Setter Property="SmallChange" Value="0.001"/>
            <Setter Property="RegularChange" Value="0.01"/>
            <Setter Property="LargeChange" Value="0.1"/>
            <Setter Property="Value" Value="0,0,0,0"/>
        </Style>
    </UserControl.Resources>
    <UserControl.CommandBindings>
        <CommandBinding Command="{StaticResource ToogleRunningCmd}" Executed="ToogleRunningCmd_Executed" CanExecute="ToogleRunningCmd_CanExecute"/>
        <CommandBinding Command="{StaticResource ToogleRecordCmd}" Executed="ToogleRecordCmd_Executed" CanExecute="ToogleRecordCmd_CanExecute"/>
        <CommandBinding Command="{StaticResource AddPermissionCmd}" Executed="AddPermissionCmd_Executed" />
        <CommandBinding Command="{StaticResource RemovePermissionCmd}" Executed="RemovePermissionCmd_Executed" />
    </UserControl.CommandBindings>
    <WrapPanel Orientation="Vertical">
        <Visualizer:Visualizer3D Height="300" Width="300" x:Name="Visualizer3DCtrl" Margin="8"/>
        <Expander Name="D3Diagram" Header="D_3Diagram" Margin="8">
            <StackPanel MaxHeight="250" MaxWidth="600" Height="250" Width="600">
                <ScrollViewer VerticalScrollBarVisibility="Disabled"  HorizontalScrollBarVisibility="Visible">
                <d3:ChartPlotter Name="plotter" Margin="10,10,20,10">
                    <d3:Header FontFamily="Arial" Content="D3Diagram"/>
                    <d3:VerticalAxisTitle FontFamily="Arial" Content="Value"/>
                    <d3:HorizontalAxisTitle FontFamily="Arial" Content="Time"/>
                </d3:ChartPlotter>
            </ScrollViewer>
            </StackPanel>
        </Expander>
        <Expander Name="HistoryVisualiser" Header="History_Visualiser">
            <controlsB3:HistoryVisualizer x:Name="History"/>
        </Expander>
        <Grid x:Name="C1">
            <WrapPanel>
                <Button Command="{StaticResource ToogleRunningCmd}" x:Name="ToogelRunningBtn" Content="Play" Margin="8,8,0,8" Padding="8,1" HorizontalAlignment="Left" d:LayoutOverrides="Height, VerticalMargin" ToolTip="Ctrl+P"/>
                <Button Command="{StaticResource ToogleRecordCmd}" x:Name="ToggleReccordBtn" Content="Record" Margin="8,8,0,8" Padding="8,1" HorizontalAlignment="Left" d:LayoutOverrides="Height, VerticalMargin" ToolTip="Ctrl+R"/>
            </WrapPanel>

        </Grid>
        <controlsB3:SettingsSaverB3 x:Name="BasicSimulationGlobalSettingsSaver" Width="500">
            <WrapPanel>
                <Expander Header="Varia_bles" Margin="8">
                    <StackPanel>
                        <Label Content="_Tilt:" Target="{Binding ElementName=TiltVecBox}"/>
                        <controls:VectorBox
                    x:Name="TiltVecBox" ValueChanged="TiltVecBox_ValueChanged" Margin="0,2,0,0"
                    SmallChange="0.02454369260617025967548940143187" RegularChange="0.04908738521234051935097880286374" LargeChange="0.09817477042468103870195760572748"
                    />
                        <Label Content="_DesiredTilt:" Target="{Binding ElementName=DesiredTiltVecBox}"/>
                        <controls:VectorBox
                    x:Name="DesiredTiltVecBox" Margin="0,2,0,0"
                    SmallChange="0.02454369260617025967548940143187" RegularChange="0.04908738521234051935097880286374" LargeChange="0.09817477042468103870195760572748"
                    />
                        <Label Content="_Position:" Target="{Binding ElementName=PositionVecBox}"/>
                        <controls:Vector3DBox x:Name="PositionVecBox" ValueChanged="PositionVecBox_ValueChanged" Margin="0,2,0,0" />
                        <Label Content="_Velocity:" Target="{Binding ElementName=VelocityVecBox}"/>
                        <controls:Vector3DBox x:Name="VelocityVecBox" Margin="0,2,0,0"/>
                        <Label Content="_Acceleration:" Target="{Binding ElementName=AccelerationVecBox}"/>
                        <controls:Vector3DBox x:Name="AccelerationVecBox" Margin="0,2,0,0"/>
                    </StackPanel>
                </Expander>
                <Expander Header="_Constants" Margin="8" >
                    <StackPanel Margin="8">
                        <controls:DoubleBox x:Name="GravityDoubleBox" Text="_Gravity:" HorizontalAlignment="Right" Value="-9.81" Margin="0" SmallChange=".1" LargeChange="1"/>
                        <controls:DoubleBox x:Name="HitAttenuationFactorDoubleBox" Text="Attenuation Factor at _Hit:" HorizontalAlignment="Right" Value="0.8" Margin="0,2,0,0"/>
                        <controls:DoubleBox x:Name="AbsoluteHitAttenuationDoubleBox" Text="Ab_solute Attenuation at Hit:" HorizontalAlignment="Right" Value="1" Margin="0,2,0,0"/>
                        <controls:DoubleBox x:Name="PlateVelocityDoubleBox" Text="P_late Velocity:" HorizontalAlignment="Right" Value="0.08725" Margin="0,2,0,0"/>
                    </StackPanel>
                </Expander>
                <Expander Header="_Options" Margin="8" >
                    <StackPanel Margin="8">
                        <!--<Label x:Name="FpsLbl" Content="_FPS:" Margin="0,2,0,0" HorizontalAlignment="Left" Target="{Binding ElementName=FpsSlider}" d:LayoutOverrides="Height"/>
                        <Slider x:Name="FpsSlider" Margin="0,2,0,0" d:LayoutOverrides="Height" MinWidth="140" Minimum=".1" Maximum="60" LargeChange="5" SmallChange="1" ValueChanged="FpsSlider_ValueChanged" AutoToolTipPlacement="BottomRight" Value="20"/>-->
                        <controls:DoubleBox x:Name="FpsSlider" Text="_Fps: " HorizontalAlignment="Left" Value="20" Margin="0,2,0,0" ValueChanged="FpsSlider_ValueChanged" SmallChange="0.1" RegularChange="1" LargeChange="10" Minimum="0.1"/>
                        <!--<controls:DoubleBox x:Name="UpdateTimeBox" Text="_UpdateTime: " HorizontalAlignment="Left" Value="0.0333333333333333333" Margin="0,2,0,0" SmallChange="0.001" RegularChange="0.01" LargeChange="0.1" Minimum="0.0"/>-->
                        <CheckBox Content="Disable Send_ing Data" x:Name="DisableSendingDataBox"/>
                        <CheckBox Content="Enable _Latency (Send Delayed Data)" x:Name="LatencyCheckBox"/>
                        <controls:DoubleBox x:Name="LatencyFramesDoubleBox" Text="Latenc_y Frames: " HorizontalAlignment="Left" Value="1" Margin="0,2,0,0" SmallChange="1" RegularChange="1" LargeChange="10" Minimum="1"/>
                        <CheckBox Content="Enable _Random Errors (Send data only)" x:Name="RandomCheckBox"/>
                        <controls:DoubleBox x:Name="RandomDoubleBox" Text="Rando_m Range: " HorizontalAlignment="Left" Value="0.01" Margin="0,2,0,0" Minimum="0"/>
                        <CheckBox Content="Enable Random Error_s (Calc)" x:Name="RandomCalcCheckBox"/>
                        <controls:DoubleBox x:Name="RandomCalcDoubleBox" Text="Random Rang_e: " HorizontalAlignment="Left" Value="0.001" Margin="0,2,0,0" Minimum="0"/>
                        <TextBox x:Name="PCSaveBox" Visibility="Collapsed" TextChanged="PCSSLoaded"/>
                        <Label Content="P_hysicsCalculators" Target="PhysicsCalculatorList"/>
                        <TreeView x:Name="PhysicsCalculatorList" SelectedItemChanged="PCSelectionChanged" Margin="7,0">
                        </TreeView>
                        
                    </StackPanel>
                </Expander>
                <Expander Header="E_xelDiagram" Margin="8">
                    <StackPanel Margin="8">
                        <CheckBox Content="2DFigure" x:Name="DiagramEnable2DFigure" IsChecked="True"/>
                        <CheckBox Content="XPosition" x:Name="DiagramEnableXPosition" IsChecked="True"/>
                        <CheckBox Content="YPosition" x:Name="DiagramEnableYPosition" IsChecked="True"/>
                        <CheckBox Content="ZPosition" x:Name="DiagramEnableZPosition" IsChecked="True"/>
                        <CheckBox Content="XVelocity" x:Name="DiagramEnableXVelocity" IsChecked="True"/>
                        <CheckBox Content="YVelocity" x:Name="DiagramEnableYVelocity" IsChecked="True"/>
                        <CheckBox Content="ZVelocity" x:Name="DiagramEnableZVelocity" IsChecked="True"/>
                        <CheckBox Content="XAcceleration" x:Name="DiagramEnableXAcceleration" IsChecked="True"/>
                        <CheckBox Content="YAcceleration" x:Name="DiagramEnableYAcceleration" IsChecked="True"/>
                        <CheckBox Content="ZAcceleration" x:Name="DiagramEnableZAcceleration" IsChecked="True"/>
                        <CheckBox Content="XTilt" x:Name="DiagramEnableXTilt" IsChecked="True"/>
                        <CheckBox Content="YTilt" x:Name="DiagramEnableYTilt" IsChecked="True"/>
                        <Label Content="DiagramWritePerm_issions" Target="PermissionList"/>
                        <TreeView x:Name="PermissionList" Margin="7,0" >
                        </TreeView>
                        <WrapPanel>
                            <Button Command="{StaticResource AddPermissionCmd}" x:Name="AddPermissionBtn" Content="Add" Margin="8,8,0,8" Padding="8,1" HorizontalAlignment="Left" d:LayoutOverrides="Height, VerticalMargin" ToolTip="Ctrl+I"/>
                            <Button Command="{StaticResource RemovePermissionCmd}" x:Name="RemovePermissionBtn" Content="Remove" Margin="8,8,0,8" Padding="8,1" HorizontalAlignment="Left" d:LayoutOverrides="Height, VerticalMargin" ToolTip="Ctrl+O"/>
                        </WrapPanel>
                    </StackPanel>
                </Expander>
            </WrapPanel>
        </controlsB3:SettingsSaverB3>
    </WrapPanel>
</UserControl>
